﻿<UserControl
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:nyt="clr-namespace:NYTimes;assembly=NYTimesSilverlightKit" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" xmlns:DemoNYTimes_ValueConverters="clr-namespace:DemoNYTimes.ValueConverters" xmlns:visualizationToolkit="clr-namespace:System.Windows.Controls.DataVisualization;assembly=System.Windows.Controls.DataVisualization.Toolkit" x:Class="DemoNYTimes.TimesPeoplePage"
    d:DesignWidth="640" d:DesignHeight="479.75">
	<UserControl.Resources>
		<nyt:TimesPeopleProfile x:Key="TimesPeopleProfileDataSource" d:IsDataSource="True"/>
		<visualizationToolkit:StringFormatConverter x:Key="StringFormatConverter"/>
		<DemoNYTimes_ValueConverters:AAnConverter x:Key="AAnConverter" Prefix=" " Suffix=" "/>
		<nyt:TimesPeopleActivities x:Key="TimesPeopleActivitiesDS" d:IsDataSource="True"/>
		<Style x:Key="TextBlockStyle1" TargetType="TextBlock">
			<Setter Property="FontFamily" Value="Times New Roman"/>
			<Setter Property="FontSize" Value="12"/>
		</Style>
		<DataTemplate x:Key="ActivityTemplate">
			<Grid>
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto"/>
					<ColumnDefinition/>
					<ColumnDefinition Width="Auto"/>
				</Grid.ColumnDefinitions>
				<Image Source="{Binding UserPicture, Mode=OneWay}" ImageFailed="OnImageFailed" HorizontalAlignment="Left" d:LayoutOverrides="Height" Margin="4"/>
				<StackPanel Grid.Column="1" Orientation="Vertical" d:LayoutOverrides="Height" Margin="4">
					<StackPanel Orientation="Horizontal">
						<TextBlock x:Name="UserDisplayName" Text="{Binding UserDisplayName}" VerticalAlignment="Bottom" Style="{StaticResource TextBlockStyle1}"/>
						<TextBlock Text=" " VerticalAlignment="Bottom" Style="{StaticResource TextBlockStyle1}"/>
						<TextBlock x:Name="Verb" Text="{Binding Verb}" VerticalAlignment="Bottom" Style="{StaticResource TextBlockStyle1}"/>
						<TextBlock x:Name="a_an" Text="{Binding ObjectType, Converter={StaticResource AAnConverter}, Mode=OneWay}" VerticalAlignment="Bottom" Style="{StaticResource TextBlockStyle1}"/>
						<TextBlock x:Name="ObjectType" Text="{Binding ObjectType}" VerticalAlignment="Bottom" Style="{StaticResource TextBlockStyle1}"/>
						<TextBlock x:Name="Colon" Text=": " VerticalAlignment="Bottom" Style="{StaticResource TextBlockStyle1}"/>
					</StackPanel>
					<HyperlinkButton Content="{Binding Object}" NavigateUri="{Binding ObjectUrl}" TargetName="_blank" d:LayoutOverrides="Width" FontStyle="Italic" FontFamily="Times New Roman" FontSize="12"/>
					<TextBlock Text="{Binding ObjectDescription, Mode=OneWay}" TextWrapping="Wrap" Style="{StaticResource TextBlockStyle1}"/>
					<TextBlock x:Name="ObjectNote" Text="{Binding ObjectNote, Mode=OneWay}" TextWrapping="Wrap" d:LayoutOverrides="VerticalAlignment, Width" FontStyle="Italic" Style="{StaticResource TextBlockStyle1}"/>
					<TextBlock Text="{Binding DateUpdated, Converter={StaticResource StringFormatConverter}, ConverterParameter=\{0:d\}, Mode=OneWay}" TextWrapping="Wrap" Style="{StaticResource TextBlockStyle1}"/>
				</StackPanel>
				<Image Source="{Binding ObjectThumbnail, Mode=OneWay}" ImageFailed="OnImageFailed" Grid.Column="2" d:LayoutOverrides="Height" Margin="4"/>
			</Grid>
		</DataTemplate>
	</UserControl.Resources>
    <Grid x:Name="LayoutRoot" Background="White" DataContext="{Binding Source={StaticResource TimesPeopleProfileDataSource}}">
    	<Grid.ColumnDefinitions>
    		<ColumnDefinition/>
    		<ColumnDefinition/>
    	</Grid.ColumnDefinitions>
    	<Grid.RowDefinitions>
    		<RowDefinition Height="Auto"/>
    		<RowDefinition/>
    	</Grid.RowDefinitions>
        
    	<StackPanel Height="Auto" HorizontalAlignment="Left" VerticalAlignment="Top" Width="Auto" Orientation="Horizontal" Grid.ColumnSpan="2">
    		<TextBlock VerticalAlignment="Center" Text="TimesPeople Email Address:" TextWrapping="Wrap"/>
    		<TextBox x:Name="EmailAddress" VerticalAlignment="Center" TextWrapping="Wrap" MinWidth="140"/>
    		<Button x:Name="GetDataButton" Content="Get Activities and Profile" Click="OnGetData"/>
    	</StackPanel>
    	<ListBox Height="Auto" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Grid.Row="1" ItemsSource="{Binding Activities, Mode=OneWay, Source={StaticResource TimesPeopleActivitiesDS}}" ItemTemplate="{StaticResource ActivityTemplate}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" HorizontalContentAlignment="Stretch"/>
    	<Grid Grid.Row="1" Grid.Column="1" DataContext="{Binding Profile, Mode=OneWay}" Margin="5">
    		<Grid.RowDefinitions>
    			<RowDefinition Height="Auto"/>
    			<RowDefinition/>
    		</Grid.RowDefinitions>
    		<Grid.ColumnDefinitions>
    			<ColumnDefinition Width="Auto"/>
    			<ColumnDefinition/>
    		</Grid.ColumnDefinitions>
    		<Image Height="100" HorizontalAlignment="Left" VerticalAlignment="Top" Width="100" Source="{Binding Picture, Mode=OneWay}"/>
    		<StackPanel HorizontalAlignment="Left" VerticalAlignment="Top" Grid.Column="1" Margin="4,0,0,0">
    			<TextBlock x:Name="DisplayName" Text="{Binding DisplayName}" FontWeight="Bold"/>
    			<TextBlock x:Name="Location" Text="{Binding Location, Mode=OneWay}" TextWrapping="Wrap"/>
    			<TextBlock x:Name="Bio" Text="{Binding Bio}" TextWrapping="Wrap"/>
    		</StackPanel>
    		<StackPanel Grid.Row="1" Grid.ColumnSpan="2">
    			<HyperlinkButton Content="{Binding Url, Mode=OneWay}" NavigateUri="{Binding Url, Mode=OneWay}" TargetName="_blank"/>
    			<StackPanel Orientation="Horizontal">
    				<TextBlock Text="Following: " TextWrapping="Wrap"/>
    				<TextBlock Text="{Binding Following, Mode=OneWay}" TextWrapping="Wrap"/>
    			</StackPanel>
    			<StackPanel Orientation="Horizontal">
    				<TextBlock Text="Followers: " TextWrapping="Wrap"/>
    				<TextBlock Text="{Binding Followers, Mode=OneWay}" TextWrapping="Wrap"/>
    			</StackPanel>
    		</StackPanel>
    	</Grid>
        
    </Grid>
</UserControl>
